<template>
  <common-page
    ref="commonPage"
    :bg-path="bgPath"
    :web-path="webPath"
    :columns="columns"
    :search-items="searchItems"
    :form-items="formItems"
  />
</template>
<script>
export default {
  data() {
    return {
      // ===== ===== ===== ===== 全局属性 ===== ===== ===== =====
      // 后台接口路径
      bgPath: 'clinic/treatment/therapy/therapyrecord',
      // Web路径
      webPath: 'clinic/treatment/therapy/TherapyRecord',
      // ===== ===== ===== ===== 页面配置 ===== ===== ===== =====
      // 搜索内容
      searchItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "storeCode",
              name: "门店编码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "therapyMaterielCode",
              name: "理疗项目编码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "therapyMaterielName",
              name: "理疗项目名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "patientCode",
              name: "患者编码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "patientName",
              name: "患者名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "stateSign",
              name: "状态标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "1", value: "待支付" },
                  { key: "2", value: "待核销" },
                  { key: "3", value: "已完成" },
                  { key: "4", value: "已关闭" }
                ]
              }
            },
            {
              code: "minPayTime",
              name: "最早支付时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "maxPayTime",
              name: "最晚支付时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "minVerTime",
              name: "最早核销时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "maxVerTime",
              name: "最晚核销时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "minTherapyTime",
              name: "最早理疗时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "maxTherapyTime",
              name: "最晚理疗时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "minCloseTime",
              name: "最早关闭时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "maxCloseTime",
              name: "最晚关闭时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            }
          ]
        }
      ],
      // 列表内容
      columns: [
        {
          code: "code",
          name: "编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "name",
          name: "患者名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "verificationCode",
          name: "核销码",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "storeCode",
          name: "门店编码",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "storeName",
          name: "门店名称",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "therapyMaterielCode",
          name: "理疗项目编码",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "therapyMaterielName",
          name: "理疗项目名称",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "patientCode",
          name: "患者信息编码",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "patientName",
          name: "患者信息名称",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "contactPhone",
          name: "电话",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "therapyAmount",
          name: "理疗费用金额",
          type: "number",
          span: 6,
          config: {
            edit: false,
            precision: 2
          }
        },
        {
          code: "discountAmount",
          name: "优惠金额",
          type: "number",
          span: 6,
          config: {
            edit: false,
            precision: 2
          }
        },
        {
          code: "paymentAmount",
          name: "支付金额",
          type: "number",
          span: 6,
          config: {
            edit: false,
            precision: 2
          }
        },
        {
          code: "stateSign",
          name: "状态标识",
          type: "select",
          span: 6,
          config: {
            edit: false,
            keyField: "key",
            valueField: "value",
            options: [
              { key: "1", value: "待支付" },
              { key: "2", value: "待核销" },
              { key: "3", value: "已完成" },
              { key: "4", value: "已关闭" }
            ]
          }
        },
        {
          code: "payTime",
          name: "支付时间",
          type: "datetime",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "verTime",
          name: "核销时间",
          type: "datetime",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "therapyTime",
          name: "理疗时间",
          type: "datetime",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "closeTime",
          name: "最早关闭时间",
          type: "datetime",
          span: 6,
          config: {
            edit: false
          }
        }
      ],
      // 增加/修改/详情 表单
      formItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false,
                require: true
              }
            },
            {
              code: "name",
              name: "患者名称",
              span: 6,
              type: "text",
              config: {
                edit: false,
                require: true
              }
            },
            {
              code: "verificationCode",
              name: "核销码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "storeCode",
              span: 6,
              name: "门店编码",
              type: "popup",
              config: {
                url: "base/user/user/store",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    storeName: row.name,
                    storeCode: row.code,
                    storeId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "therapyMaterielCode",
              span: 6,
              name: "理疗项目编码",
              type: "popup",
              config: {
                url: "clinic/treatment/therapy/therapymateriel",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    therapyMaterielName: row.name,
                    therapyMaterielCode: row.code,
                    therapyMaterielId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "therapyMaterielName",
              name: "理疗项目名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "patientCode",
              span: 6,
              name: "患者信息编码",
              type: "popup",
              config: {
                url: "clinic/treatment/patient/patient",
                filedList: [
                  { code: 'id', name: 'ID' },
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    patientName: row.name,
                    patientCode: row.code,
                    patientId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "patientName",
              name: "患者信息名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "contactPhone",
              name: "电话",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "therapyAmount",
              name: "理疗费用金额",
              type: "number",
              span: 6,
              config: {
                edit: false,
                precision: 2
              }
            },
            {
              code: "discountAmount",
              name: "优惠金额",
              type: "number",
              span: 6,
              config: {
                edit: false,
                precision: 2
              }
            },
            {
              code: "paymentAmount",
              name: "支付金额",
              type: "number",
              span: 6,
              config: {
                edit: false,
                precision: 2
              }
            },
            {
              code: "stateSign",
              name: "状态标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "1", value: "待支付" },
                  { key: "2", value: "待核销" },
                  { key: "3", value: "已完成" },
                  { key: "4", value: "已关闭" }
                ]
              }
            },
            {
              code: "payTime",
              name: "支付时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "verTime",
              name: "核销时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "therapyTime",
              name: "理疗时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "closeTime",
              name: "最早关闭时间",
              type: "datetime",
              span: 6,
              config: {
                edit: false
              }
            }
          ]
        }
      ]
    }
  }
}
</script>
